<?php $this->load->view('common/head');?>
<?php $this->load->view('common/navbar');?>
<style>
.table th, .table td {text-align:left; }
</style>
<div class="panel panel-default">
  <!-- Default panel contents -->
  <div class="panel-heading">地方车展新增</div>
  <div class="panel-body">
	  <div class="col-md-10 col-md-offset-1">
		<form class="form-inline" name="add" id="add" action="<?php echo $this->input->server('REQUEST_URI'); ?>" method="post">
		  <input type="hidden" name="id" id="id" value="<?=isset($projectData['id']) ? $projectData['id'] : ''?>">
		  <input type="hidden" name="procId" id="procId" value="<?=isset($projectData['procId']) ? $projectData['procId'] : $procId?>">
		  <input type="hidden" name="isBubao" id="isBubao" value="<?=isset($projectData['isBubao']) ? $projectData['isBubao'] : $isBubao?>">
	  	  <!-- Table -->
		  <table class="table table-condensed">
		    <tbody>
		      <tr>
		        <td class="bg-primary col-md-3"><label for="name" class="control-label">车展名称：</label></td>
		        <td><input type="input" required class="form-control" name="name" id="name" value="<?=isset($projectData['name']) ? $projectData['name'] : ''?>" placeholder="车展名称"></td>
		      </tr>
		      <tr>
		        <td class="bg-primary"><label for="level" class="control-label">车展等级：</label></td>
		        <td>
		        	<select class="form-control" required placeholder=".col-xs-4" id="level" name="level">
		        		<option value="">请选择</option>
			          </select>
		        </td>
		      </tr>
		      <tr>
		        <td class="bg-primary col-md-3"><label for="eventType" class="control-label">活动时间段：</label></td>
		        <td>
		        <input type="input" required class="form-control" onFocus="WdatePicker({minDate:'<?=date("Y-m-d", $this->timeUnitModel->getTimeUnitStartTime($procData['timeUnit'], $procData['year'])-86400*10)?>',maxDate:'#F{$dp.$D(\'endTime\')||\'<?=date("Y-m-d", $this->timeUnitModel->getTimeUnitEndTime($procData['timeUnit'], $procData['year']))?>\'}'})" name="startTime" id="startTime" value="<?=isset($projectData['startTime']) ? $projectData['startTime'] : ''?>" placeholder="开始时间">
		        至
		        <input type="input" required class="form-control" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'startTime\')||\'<?=date("Y-m-d", $this->timeUnitModel->getTimeUnitStartTime($procData['timeUnit'], $procData['year'])-86400*10)?>\'}',maxDate:'<?=date("Y-m-d", $this->timeUnitModel->getTimeUnitEndTime($procData['timeUnit'], $procData['year']))?>'})" name="endTime" id="endTime" value="<?=isset($projectData['endTime']) ? $projectData['endTime'] : ''?>" placeholder="结束时间">
		        </td>
		      </tr>
		      <tr>
		        <td class="bg-primary col-md-3"><label for="address" class="control-label">场馆地址：</label></td>
		        <td>
			        <input type="input" required class="form-control" name="address" id="address" value="<?=isset($projectData['address']) ? $projectData['address'] : ''?>" placeholder="场馆地址">
		        </td>
		      </tr>
		      <tr>
		      	<td></td>
		      	<td>
		      		<button type="submit" class="btn btn-default btn-primary">下一步</button>
		      		<button type="button" onclick="history.go(-1)" class="btn btn-default btn-primary">取消</button>
		      	</td>
		      </tr>
		    </tbody>
		  </table>
		</form>
		</div>
	</div>
</div>
<script type="text/javascript" src="public/js/commonCarshow.js"></script>
<script type="text/javascript">
$(function(){
	initValidation();
	loadCarshowLevel(<?=isset($projectData['level']) ? $projectData['level'] : 0?>);
});
//初始化验证
function initValidation(){
  $('form[name="add"]').find("input,select,textarea").jqBootstrapValidation("destroy");
  $('form[name="add"]').find("input,select,textarea").not("[type=submit]").jqBootstrapValidation({
      preventSubmit:false,
      submitSuccess: function (form, event) {
           event.preventDefault();
           ajaxFormSubmit('add');
       },
       submitError: function (form, event, errors) {
         event.preventDefault();
         }
    });
}
</script>
<?php $this->load->view('common/foot');?>